package com.hrms.common.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.hrms.common.annotation.ExportTitil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.Date;

/**
 * BaseEntity-基础类
 * @author pangzhiwei
 * @date 2017-5-24
 */
@SuppressWarnings("serial")
@ApiModel(description = "基础实体类")
@Setter
@Getter
public abstract class BaseEntity implements Serializable {

    @TableId(type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "主键id")
    protected Long id; // 数据库标识符

    @TableField(value = "created_by",fill = FieldFill.INSERT)
    protected String createdBy;

    @TableField(value = "created_on",fill = FieldFill.INSERT)
    @ExportTitil(value = "创建时间",dateFormatPattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    protected Date createdOn;

    @TableField(value = "last_modified_by",fill = FieldFill.UPDATE)
    protected String lastModifiedBy;

    @TableField(value = "last_modified_on",fill = FieldFill.UPDATE)
    @ExportTitil(value = "修改时间",dateFormatPattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    protected Date lastModifiedOn;

}